home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / sqlsomdb / sample42 / mainform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-01  |  22.2 KB  |  669 lines

  1. VERSION 2.00
  2. Begin Form Mainform 
  3.    BackColor       =   &H00FFFFC0&
  4.    Caption         =   "Test SQL-Sombrero VBX - Author Application"
  5.    ClientHeight    =   4725
  6.    ClientLeft      =   1185
  7.    ClientTop       =   1350
  8.    ClientWidth     =   7680
  9.    Height          =   5130
  10.    Left            =   1125
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4725
  13.    ScaleWidth      =   7680
  14.    Top             =   1005
  15.    Width           =   7800
  16.    Begin DEMVBXDB SQLVBXDB1 
  17.       Left            =   180
  18.       Top             =   3900
  19.    End
  20.    Begin ComboBox author_list 
  21.       FontBold        =   -1  'True
  22.       FontItalic      =   0   'False
  23.       FontName        =   "Fixedsys"
  24.       FontSize        =   9
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   330
  28.       Left            =   240
  29.       Style           =   2  'Dropdown List
  30.       TabIndex        =   25
  31.       Top             =   120
  32.       Width           =   6855
  33.    End
  34.    Begin CommandButton delbut 
  35.       Caption         =   "Delete Author"
  36.       Height          =   615
  37.       Left            =   6000
  38.       TabIndex        =   24
  39.       Top             =   2040
  40.       Visible         =   0   'False
  41.       Width           =   1335
  42.    End
  43.    Begin CommandButton cancelbut 
  44.       Caption         =   "Cancel"
  45.       Height          =   495
  46.       Left            =   6240
  47.       TabIndex        =   23
  48.       Top             =   3840
  49.       Visible         =   0   'False
  50.       Width           =   855
  51.    End
  52.    Begin CommandButton newrec 
  53.       Caption         =   "Add New"
  54.       Height          =   615
  55.       Left            =   6000
  56.       TabIndex        =   22
  57.       Top             =   1320
  58.       Visible         =   0   'False
  59.       Width           =   1335
  60.    End
  61.    Begin CommandButton updbut 
  62.       Caption         =   "Update Info"
  63.       Height          =   615
  64.       Left            =   6000
  65.       TabIndex        =   21
  66.       Top             =   3120
  67.       Visible         =   0   'False
  68.       Width           =   1335
  69.    End
  70.    Begin CommandButton chgbut 
  71.       Caption         =   "Change Info"
  72.       Height          =   615
  73.       Left            =   6000
  74.       TabIndex        =   20
  75.       Top             =   600
  76.       Visible         =   0   'False
  77.       Width           =   1335
  78.    End
  79.    Begin TextBox Text1 
  80.       Enabled         =   0   'False
  81.       Height          =   285
  82.       Index           =   8
  83.       Left            =   1560
  84.       MaxLength       =   1
  85.       TabIndex        =   19
  86.       Top             =   3480
  87.       Visible         =   0   'False
  88.       Width           =   3855
  89.    End
  90.    Begin TextBox Text1 
  91.       Enabled         =   0   'False
  92.       Height          =   285
  93.       Index           =   7
  94.       Left            =   1560
  95.       MaxLength       =   5
  96.       TabIndex        =   18
  97.       Top             =   3120
  98.       Visible         =   0   'False
  99.       Width           =   3855
  100.    End
  101.    Begin TextBox Text1 
  102.       Enabled         =   0   'False
  103.       Height          =   285
  104.       Index           =   6
  105.       Left            =   1560
  106.       MaxLength       =   2
  107.       TabIndex        =   17
  108.       Top             =   2760
  109.       Visible         =   0   'False
  110.       Width           =   3855
  111.    End
  112.    Begin TextBox Text1 
  113.       Enabled         =   0   'False
  114.       Height          =   285
  115.       Index           =   5
  116.       Left            =   1560
  117.       MaxLength       =   20
  118.       TabIndex        =   16
  119.       Top             =   2400
  120.       Visible         =   0   'False
  121.       Width           =   3855
  122.    End
  123.    Begin TextBox Text1 
  124.       Enabled         =   0   'False
  125.       Height          =   285
  126.       Index           =   4
  127.       Left            =   1560
  128.       MaxLength       =   40
  129.       TabIndex        =   15
  130.       Top             =   2040
  131.       Visible         =   0   'False
  132.       Width           =   3855
  133.    End
  134.    Begin TextBox Text1 
  135.       Enabled         =   0   'False
  136.       Height          =   285
  137.       Index           =   3
  138.       Left            =   1560
  139.       MaxLength       =   12
  140.       TabIndex        =   14
  141.       Top             =   1680
  142.       Visible         =   0   'False
  143.       Width           =   3855
  144.    End
  145.    Begin TextBox Text1 
  146.       Enabled         =   0   'False
  147.       Height          =   285
  148.       Index           =   2
  149.       Left            =   1560
  150.       MaxLength       =   20
  151.       TabIndex        =   13
  152.       Top             =   1320
  153.       Visible         =   0   'False
  154.       Width           =   3855
  155.    End
  156.    Begin TextBox Text1 
  157.       Enabled         =   0   'False
  158.       Height          =   285
  159.       Index           =   1
  160.       Left            =   1560
  161.       MaxLength       =   40
  162.       TabIndex        =   12
  163.       Top             =   960
  164.       Visible         =   0   'False
  165.       Width           =   3855
  166.    End
  167.    Begin TextBox Text1 
  168.       Enabled         =   0   'False
  169.       Height          =   285
  170.       Index           =   0
  171.       Left            =   1560
  172.       MaxLength       =   11
  173.       TabIndex        =   11
  174.       Top             =   600
  175.       Visible         =   0   'False
  176.       Width           =   3855
  177.    End
  178.    Begin CommandButton exitbut 
  179.       Caption         =   "Exit"
  180.       Height          =   375
  181.       Left            =   4200
  182.       TabIndex        =   1
  183.       Top             =   3960
  184.       Width           =   1095
  185.    End
  186.    Begin CommandButton multibut 
  187.       Caption         =   "Logon"
  188.       Height          =   375
  189.       Left            =   1320
  190.       TabIndex        =   0
  191.       Top             =   3960
  192.       Width           =   1095
  193.    End
  194.    Begin Shape Shape2 
  195.       BorderWidth     =   3
  196.       Height          =   2295
  197.       Left            =   5880
  198.       Top             =   480
  199.       Visible         =   0   'False
  200.       Width           =   1575
  201.    End
  202.    Begin Shape Shape1 
  203.       BorderWidth     =   3
  204.       Height          =   1455
  205.       Left            =   5880
  206.       Top             =   3000
  207.       Visible         =   0   'False
  208.       Width           =   1575
  209.    End
  210.    Begin Label Label1 
  211.       Alignment       =   1  'Right Justify
  212.       BackColor       =   &H00FFFFC0&
  213.       Caption         =   "Contract :"
  214.       Height          =   255
  215.       Index           =   8
  216.       Left            =   120
  217.       TabIndex        =   10
  218.       Top             =   3480
  219.       Visible         =   0   'False
  220.       Width           =   1215
  221.    End
  222.    Begin Label Label1 
  223.       Alignment       =   1  'Right Justify
  224.       BackColor       =   &H00FFFFC0&
  225.       Caption         =   "ZIP :"
  226.       Height          =   255
  227.       Index           =   7
  228.       Left            =   120
  229.       TabIndex        =   9
  230.       Top             =   3120
  231.       Visible         =   0   'False
  232.       Width           =   1215
  233.    End
  234.    Begin Label Label1 
  235.       Alignment       =   1  'Right Justify
  236.       BackColor       =   &H00FFFFC0&
  237.       Caption         =   "State :"
  238.       Height          =   255
  239.       Index           =   6
  240.       Left            =   120
  241.       TabIndex        =   8
  242.       Top             =   2760
  243.       Visible         =   0   'False
  244.       Width           =   1215
  245.    End
  246.    Begin Label Label1 
  247.       Alignment       =   1  'Right Justify
  248.       BackColor       =   &H00FFFFC0&
  249.       Caption         =   "City :"
  250.       Height          =   255
  251.       Index           =   5
  252.       Left            =   120
  253.       TabIndex        =   7
  254.       Top             =   2400
  255.       Visible         =   0   'False
  256.       Width           =   1215
  257.    End
  258.    Begin Label Label1 
  259.       Alignment       =   1  'Right Justify
  260.       BackColor       =   &H00FFFFC0&
  261.       Caption         =   "Address :"
  262.       Height          =   255
  263.       Index           =   4
  264.       Left            =   120
  265.       TabIndex        =   6
  266.       Top             =   2040
  267.       Visible         =   0   'False
  268.       Width           =   1215
  269.    End
  270.    Begin Label Label1 
  271.       Alignment       =   1  'Right Justify
  272.       BackColor       =   &H00FFFFC0&
  273.       Caption         =   "Phone # :"
  274.       Height          =   255
  275.       Index           =   3
  276.       Left            =   120
  277.       TabIndex        =   5
  278.       Top             =   1680
  279.       Visible         =   0   'False
  280.       Width           =   1215
  281.    End
  282.    Begin Label Label1 
  283.       Alignment       =   1  'Right Justify
  284.       BackColor       =   &H00FFFFC0&
  285.       Caption         =   "First Name :"
  286.       Height          =   255
  287.       Index           =   2
  288.       Left            =   120
  289.       TabIndex        =   4
  290.       Top             =   1320
  291.       Visible         =   0   'False
  292.       Width           =   1215
  293.    End
  294.    Begin Label Label1 
  295.       Alignment       =   1  'Right Justify
  296.       BackColor       =   &H00FFFFC0&
  297.       Caption         =   "Last Name :"
  298.       Height          =   255
  299.       Index           =   1
  300.       Left            =   120
  301.       TabIndex        =   3
  302.       Top             =   960
  303.       Visible         =   0   'False
  304.       Width           =   1215
  305.    End
  306.    Begin Label Label1 
  307.       Alignment       =   1  'Right Justify
  308.       BackColor       =   &H00FFFFC0&
  309.       Caption         =   "Author Id :"
  310.       Height          =   255
  311.       Index           =   0
  312.       Left            =   120
  313.       TabIndex        =   2
  314.       Top             =   600
  315.       Visible         =   0   'False
  316.       Width           =   1215
  317.    End
  318. Dim t(1 To 3) As String
  319. Sub author_list_Click ()
  320.     show_author
  321.     chgbut.Visible = True
  322.     delbut.Visible = True
  323. End Sub
  324. Sub cancelbut_Click ()
  325.     author_list.Enabled = True
  326.     If author_list.ListIndex <> -1 Then
  327.     chgbut.Visible = True
  328.     delbut.Visible = True
  329.     End If
  330.     updbut.Visible = False
  331.     newrec.Visible = True
  332.     cancelbut.Visible = False
  333.     For i = 0 To 8
  334.     text1(i).Enabled = False
  335.     Next
  336.     show_author
  337. End Sub
  338. Sub chgbut_Click ()
  339.     For i = 1 To 8
  340.        text1(i).Enabled = True
  341.     Next
  342.     author_list.Enabled = False
  343.     chgbut.Visible = False
  344.     updbut.Visible = True
  345.     newrec.Visible = False
  346.     delbut.Visible = False
  347.     cancelbut.Visible = True
  348.     updflag = 1
  349.     text1(1).SetFocus
  350. End Sub
  351. Sub delbut_Click ()
  352.     updflag = 3
  353.     updbut.Visible = True
  354.     chgbut.Visible = False
  355.     newrec.Visible = False
  356.     cancelbut.Visible = True
  357.     delbut.Visible = False
  358.     author_list.Enabled = False
  359. End Sub
  360. Sub exitbut_Click ()
  361.     If dbconn <> 0 Then
  362.     SqlClose (dbconn)
  363.     End If
  364.     sqlwinexit
  365.     sqlexit
  366.     End
  367. End Sub
  368. Sub Form_Load ()
  369.     updflag = 0
  370. End Sub
  371. Sub multibut_Click ()
  372.     logon.Show 1
  373.     If multibut.Visible = True Then
  374.     Exit Sub
  375.     End If
  376.     newrec.Visible = True
  377. '   Once the user has logged on to the server the list box will be
  378. '   populated with a list of the Author Id, Last Name, and First Name
  379. '   The first function is to place the SQL Statement required to get
  380. '   this information from the server into the command buffer using
  381. '   the SqlCmd function
  382.     ret = SqlCmd(dbconn, "select 'Author Id' = au_id , 'Last Name' = au_lname , 'First Name' = au_fname  from authors")
  383.     If ret = 1 Then
  384. '   The SqlExec function is then used to send the SQL Statement to the
  385. '   server for execution. It is at this point that syntax checking is
  386. '   performed
  387.     ret = SqlExec(dbconn)
  388.     If ret = 1 Then
  389.         
  390. '   If the command syntax was correct the command will be executing at
  391. '   the server now. The next function is the SqlResults function. This
  392. '   function will return once the processing is complete on the server.
  393. '   If the SqlCmd function had been passed more than one SQL command then
  394. '   you must perform a SqlResults for each result set being sent back.
  395. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  396. '   from SqlResults
  397.         ret = SqlResults(dbconn)
  398.         If ret = 1 Then
  399. '   Once the SqlResults returns with the indication that a result set
  400. '   is available we can get the number of columns in the result set. In
  401. '   this application this function is not required since we know how
  402. '   many columns were requested. If the application allowed for AdHoc
  403. '   SQL requests then this function is used to indicate the number of
  404. '   columns of data available.
  405.         cols% = SqlNumCols(dbconn)
  406. '   To get the column headings we use the SqlColName function. This function
  407. '   will return either the column name based on the internal column name or
  408. '   if the syntax 'Column Name' = colname is used to override the internal
  409. '   column name. In our example we have chosen to override the column name
  410.         For c% = 1 To cols%
  411.             colnam$ = SqlColName(dbconn, c%)
  412.         Next
  413. '   Once the result set is available for processing each row needs to be
  414. '   retrieved. This is accomplished by calling SqlNextRow until the function
  415. '   returns NOMOREROWS(-2)
  416.         ret = SqlNextRow(dbconn)
  417.         While ret <> NOMOREROWS
  418. '   For each column in the result set we call the function SqlData to
  419. '   get the data returned for the column. The data returned is a string
  420. '   representation of the data in the result column. The data is right
  421. '   trimmed when returned. The data when return is being concatonated
  422. '   with tabs (chr(9)) between each item to populate the drop down list
  423. '   box with three columns
  424.             
  425.             
  426.             For c% = 1 To cols%
  427.             t(c%) = SqlData(dbconn, c%)
  428.             Next
  429.             aitem$ = t(1) & Space(15 - Len(t(1))) & Left(t(2) & Space(41 - Len(t(2))), 20) & t(3)
  430.             author_list.AddItem aitem$
  431.             ret = SqlNextRow(dbconn)
  432.         Wend
  433.         End If
  434.     End If
  435.     End If
  436.     If ret <> NOMOREROWS Then
  437.     Exit Sub
  438.     End If
  439.     For i = 0 To 8
  440.     label1(i).Visible = True
  441.     text1(i).Visible = True
  442.     Next
  443.     author_list.Visible = True
  444.     newrec.Visible = True
  445.     shape1.Visible = True
  446.     shape2.Visible = True
  447. End Sub
  448. Sub newrec_Click ()
  449.     updflag = 2
  450.     updbut.Visible = True
  451.     chgbut.Visible = False
  452.     newrec.Visible = False
  453.     cancelbut.Visible = True
  454.     delbut.Visible = False
  455.     author_list.Enabled = False
  456.     For i = 0 To 8
  457.     text1(i).Enabled = True
  458.     text1(i).Text = ""
  459.     Next
  460.     text1(0).SetFocus
  461. End Sub
  462. Function process_no_rows () As Integer
  463. '   If the SQL Statement was successfully placed into the command buffer then
  464. '   send the command to the server for execution.
  465.     ret = SqlExec(dbconn)
  466.     If ret = 1 Then
  467. '   The SqlResults function will wait until the function is complete on
  468. '   the server. A return of 1 indicates that the statement has been executed
  469. '   on the server
  470.     ret = SqlResults(dbconn)
  471.     If ret = 1 Then
  472. '   In the case of a delete there are no rows returned in the result set
  473. '   the SqlRows command will confirm that no rows were returned.
  474.         ret = SqlRows(dbconn)
  475.         If ret = 1 Then
  476.         MsgBox "This command should not return rows"
  477.         Else
  478.         If updflag = 1 Then
  479.             MsgBox "Information changed for au_id " & text1(0).Text
  480.         Else
  481.             If updflag = 2 Then
  482.             MsgBox "Information added for au_id " & text1(0).Text
  483.             Else
  484.             MsgBox "Information deleted for au_id " & text1(0).Text
  485.             End If
  486.         End If
  487.         End If
  488.     Else
  489.         process_no_rows = ret
  490.         Exit Function
  491.     End If
  492.     Else
  493.     process_no_rows = ret
  494.     Exit Function
  495.     End If
  496.     process_no_rows = 99
  497. End Function
  498. Sub show_author ()
  499.     lc = author_list.ListIndex
  500.     If lc = -1 Then
  501.     Exit Sub
  502.     End If
  503. '    author_list.Row = lc
  504. '    author_list.Col = 0
  505.     d$ = RTrim(Left(author_list.List(lc), 15))
  506. '   Once the author has been selected from the list of authors
  507. '   process a SQL Statement which will select all the fields
  508. '   from the authors table for the author selected from the list
  509. '   by using the where clause on the primary key of the table
  510. '   The checking the ret variable for 1 indicates a test for a
  511. '   success. If the ret variable contains a 0 then the function
  512. '   failed
  513.     ret = SqlCmd(dbconn, "select * from authors where au_id = " & Chr(34) & d$ & Chr$(34))
  514.     If ret = 1 Then
  515. '   If the command was accepted into the buffer in the statement above
  516. '   then send it to the server for execution. If there are syntax
  517. '   errors in the statement then they will be found in the SqlExec step
  518.     ret = SqlExec(dbconn)
  519.     If ret = 1 Then
  520. '   If the command syntax was correct the command will be executing at
  521. '   the server now. The next function is the SqlResults function. This
  522. '   function will return once the processing is complete on the server.
  523. '   If the SqlCmd function had been passed more than one SQL command then
  524. '   you must perform a SqlResults for each result set being sent back.
  525. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  526. '   from SqlResults
  527.         ret = SqlResults(dbconn)
  528.         If ret = 1 Then
  529. '   Once the result set is available for processing each row needs to be
  530. '   retrieved. This is accomplished by calling SqlNextRow until the function
  531. '   returns NOMOREROWS(-2)
  532.         ret = SqlNextRow(dbconn)
  533.         While ret <> NOMOREROWS
  534. '   For each column in the result set we call the function SqlData to
  535. '   get the data returned for the column. The data returned is a string
  536. '   representation of the data in the result column. The data is right
  537. '   trimmed when returned.
  538.             For c% = 1 To 9
  539.             dat$ = SqlData(dbconn, c%)
  540.             text1(c% - 1).Text = dat$
  541.             Next
  542.             ret = SqlNextRow(dbconn)
  543.         Wend
  544.         End If
  545.     End If
  546.     End If
  547. End Sub
  548. Sub SQLVBXDB1_ERROR (Sqlconn As Integer, Severity As Integer, ErrorNum As Integer, OsError As Integer, ErrorStr As String, OsErrorStr As String, RetCode As Integer)
  549. '   This is a SQL Server callback routine
  550. '   When the server needs to inform the user of a error this callback is
  551. '   called. For example if the user tries to logon to a server which does
  552. '   not exist then the error message string (errorstr) will contain text
  553. '   indicating that a connection with the requested server cannot be made.
  554. '   It is also this routine which is called when syntax errors are discovered
  555. '   in SQL commands submitted for execution.
  556.     MsgBox ErrorStr
  557. End Sub
  558. Sub SQLVBXDB1_MESSAGE (Sqlconn As Integer, Message As Long, State As Integer, Severity As Integer, msgstr As String, ServerName As String, ProcName As String, LineNum As Integer)
  559. '   This is a SQL Server callback routine
  560. '   When the server needs to inform the user of a status change this callback is
  561. '   used. For example when the user changes databases using the SqlUse function
  562. '   this event procedure will be called and the message string (msgstr) will
  563. '   contain text indicating the new database name.
  564. '   The variable severity can be used to filter the messages so that only messages
  565. '   which need to be seen can be displayed to the user
  566.     MsgBox msgstr
  567. End Sub
  568. Sub Text1_KeyPress (index As Integer, keyascii As Integer)
  569.     If updflag = 0 Then
  570.     keyascii = 0
  571.     End If
  572. End Sub
  573. Sub updbut_Click ()
  574.     Dim sql As String
  575.     If updflag = 3 Then
  576.     GoTo dontcheck
  577.     End If
  578.     If text1(0).Text = "" Then
  579.     MsgBox "Author Id cannot be NULL"
  580.     Exit Sub
  581.     End If
  582.     If text1(1).Text = "" Then
  583.     MsgBox "Last name cannot be NULL"
  584.     Exit Sub
  585.     End If
  586.     If text1(2).Text = "" Then
  587.     MsgBox "First name cannot be NULL"
  588.     Exit Sub
  589.     End If
  590.     If text1(3).Text = "" Then
  591.     MsgBox "Phone # cannot be NULL"
  592.     Exit Sub
  593.     End If
  594.     If text1(8).Text = "" Then
  595.     MsgBox "Contract cannot be NULL"
  596.     Exit Sub
  597.     End If
  598. dontcheck:
  599.     If updflag = 1 Then
  600. '   In this application if the updflag is set to 1 then we are modifing the
  601. '   data for a particular row in the table authors. The following code will
  602. '   create a SQL Statement to 'UPDATE' the authors table where the au_id field
  603. '   is equal to the requested author id.
  604.     sql = "update authors set "
  605.     sql = sql & " au_lname = " & Chr(34) & text1(1).Text & Chr(34) & " ,"
  606.     sql = sql & " au_fname = " & Chr(34) & text1(2).Text & Chr(34) & " ,"
  607.     sql = sql & " phone = " & Chr(34) & text1(3).Text & Chr(34) & " ,"
  608.     sql = sql & " address = " & Chr(34) & text1(4).Text & Chr(34) & " ,"
  609.     sql = sql & " city = " & Chr(34) & text1(5).Text & Chr(34) & " ,"
  610.     sql = sql & " state = " & Chr(34) & text1(6).Text & Chr(34) & " ,"
  611.     sql = sql & " zip = " & Chr(34) & text1(7).Text & Chr(34) & " ,"
  612.     sql = sql & " contract = convert(bit," & Chr(34) & text1(8).Text & Chr(34) & ")"
  613.     sql = sql & " where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  614.     Else
  615.     If updflag = 2 Then
  616. '   In this application if the updflag is set to 2 then we are adding
  617. '   data for a particular row in the table authors. The following code will
  618. '   create a SQL Statement to 'INSERT' a row into the authors table where the
  619. '   au_id field is equal to the requested author id.
  620.         
  621.         sql = "insert authors values ("
  622.         For i = 0 To 7
  623.         sql = sql & Chr(34) & text1(i).Text & Chr(34) & " , "
  624.         Next
  625.         sql = sql & "convert(bit," & Chr(34) & text1(8).Text & Chr(34) & "))"
  626.     Else
  627. '   In this application if the updflag is set to 3 then we are deleting
  628. '   an author record from the table
  629. '   The SQL statement will delete a row from the table based on the
  630. '   primary key (au_id)
  631.         sql = "delete from authors where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  632.     End If
  633.     End If
  634.     ret = SqlCmd(dbconn, sql)
  635.     If ret = 1 Then
  636. '   If the command was successfully placed in the command buffer then call
  637. '   the subroutine to process a SQL Statement with no rows being returned
  638.     ret = process_no_rows()
  639.     End If
  640.     If ret = 99 Then
  641.     If updflag = 2 Then
  642.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  643.         author_list.AddItem aitem$
  644.         author_list.ListIndex = author_list.ListCount - 1
  645.     Else
  646.         If updflag = 1 Then
  647.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  648.         lc = author_list.ListIndex
  649.         author_list.List(lc) = aitem$
  650.         Else
  651.         lc = author_list.ListIndex
  652.         author_list.RemoveItem lc
  653.         author_list.ListIndex = 0
  654.         End If
  655.     End If
  656.     Else
  657.     Exit Sub
  658.     End If
  659.     author_list.Enabled = True
  660.     chgbut.Visible = True
  661.     updbut.Visible = False
  662.     newrec.Visible = True
  663.     cancelbut.Visible = False
  664.     delbut.Visible = True
  665.     For i = 0 To 8
  666.     text1(i).Enabled = False
  667.     Next
  668. End Sub
  669.